Skip to content

[CIR][NFC] Add example for get_bitfield with volatile qualifier #147828

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 10, 2025

Conversation

Andres-Salamanca
Copy link
Contributor

The example demonstrates how get_bitfield is emitted when accessing a bitfield declared as volatile.

@llvmbot llvmbot added clang Clang issues not falling into any other category ClangIR Anything related to the ClangIR project labels Jul 9, 2025
@llvmbot
Copy link
Member

llvmbot commented Jul 9, 2025

@llvm/pr-subscribers-clangir

Author: None (Andres-Salamanca)

Changes

The example demonstrates how get_bitfield is emitted when accessing a bitfield declared as volatile.


Full diff: https://github.com/llvm/llvm-project/pull/147828.diff

1 Files Affected:

  • (modified) clang/include/clang/CIR/Dialect/IR/CIROps.td (+3)
diff --git a/clang/include/clang/CIR/Dialect/IR/CIROps.td b/clang/include/clang/CIR/Dialect/IR/CIROps.td
index 6529f1386599c..8041630112ab5 100644
--- a/clang/include/clang/CIR/Dialect/IR/CIROps.td
+++ b/clang/include/clang/CIR/Dialect/IR/CIROps.td
@@ -1685,6 +1685,9 @@ def GetBitfieldOp : CIR_Op<"get_bitfield"> {
 
     A unit attribute `volatile` can be used to indicate a volatile load of the
     bitfield.
+    ```mlir
+      cir.get_bitfield(#bfi, %0 {is_volatile} : !cir.ptr<!u64i>) -> !s32i
+    ```
 
     Example:
     Suppose we have a struct with multiple bitfields stored in

@llvmbot
Copy link
Member

llvmbot commented Jul 9, 2025

@llvm/pr-subscribers-clang

Author: None (Andres-Salamanca)

Changes

The example demonstrates how get_bitfield is emitted when accessing a bitfield declared as volatile.


Full diff: https://github.com/llvm/llvm-project/pull/147828.diff

1 Files Affected:

  • (modified) clang/include/clang/CIR/Dialect/IR/CIROps.td (+3)
diff --git a/clang/include/clang/CIR/Dialect/IR/CIROps.td b/clang/include/clang/CIR/Dialect/IR/CIROps.td
index 6529f1386599c..8041630112ab5 100644
--- a/clang/include/clang/CIR/Dialect/IR/CIROps.td
+++ b/clang/include/clang/CIR/Dialect/IR/CIROps.td
@@ -1685,6 +1685,9 @@ def GetBitfieldOp : CIR_Op<"get_bitfield"> {
 
     A unit attribute `volatile` can be used to indicate a volatile load of the
     bitfield.
+    ```mlir
+      cir.get_bitfield(#bfi, %0 {is_volatile} : !cir.ptr<!u64i>) -> !s32i
+    ```
 
     Example:
     Suppose we have a struct with multiple bitfields stored in

Copy link
Collaborator

@erichkeane erichkeane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a test as well?

Copy link
Contributor

@andykaylor andykaylor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@Andres-Salamanca Andres-Salamanca merged commit 78e0c76 into llvm:main Jul 10, 2025
9 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 10, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-aarch64-darwin running on doug-worker-4 while building clang at step 2 "checkout".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/190/builds/23254

Here is the relevant piece of the build log for the reference
Step 2 (checkout) failure: update (failure)
git version 2.39.3 (Apple Git-146)
error: cannot open '.git/FETCH_HEAD': No space left on device
error: cannot open '.git/FETCH_HEAD': No space left on device

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang Clang issues not falling into any other category ClangIR Anything related to the ClangIR project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants